<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>smoothScroll</title>
    <style>
        .test {
            width: 200px;
            height: 200px;
            border: 1px solid #383838;
        }

        .max-height {
            height: 2000px;
        }
    </style>
</head>

<body>
    <div class="max-height"></div>
    <div id="test" class="test">xxxxx</div>
    <script>
        const smoothScroll = element =>
            document.querySelector(element).scrollIntoView({ behavior: 'smooth' });
        smoothScroll('.test')
    </script>
</body>

</html>